/**
 * 分镜导出系统类型定义
 */

export enum ExportType {
  PDF = 'pdf',
  EXCEL = 'excel',
  TEXT = 'text',
  MARKDOWN = 'markdown'
}

export interface ExportOptions {
  // 导出类型
  type: ExportType
  
  // 导出内容选择
  includeAll: boolean
  selectedSceneIds?: string[]
  
  // 包含信息选择
  includeThumbnails: boolean
  includeTechnicalParams: boolean
  includeStatistics: boolean
  includeNotes: boolean
  
  // 样式配置
  template?: string
  pageSize?: 'A4' | 'Letter' | 'A3'
  orientation?: 'portrait' | 'landscape'
  
  // 文件配置
  fileName?: string
  quality?: 'low' | 'medium' | 'high'
}

export interface ExportStatistics {
  totalScenes: number
  totalDuration: number
  averageDuration: number
  longestScene: { title: string; duration: number } | null
  shortestScene: { title: string; duration: number } | null
  scenesByType: Record<string, number>
  locationCount: number
  characterCount: number
}

export interface ExportData {
  projectInfo: {
    title: string
    description?: string
    createdAt: Date
    totalScenes: number
    totalDuration: number
  }
  scenes: ExportSceneData[]
  statistics: ExportStatistics
}

export interface ExportSceneData {
  id: string
  order: number
  title: string
  description: string
  duration: number
  
  // 镜头信息
  shotType: string
  cameraAngle: string
  cameraMovement?: string
  
  // 场景信息
  location: string
  locationType: string
  lighting: string
  
  // 人物和道具
  characters: string[]
  props: string[]
  
  // 制作信息
  priority: string
  complexity: string
  notes?: string
  
  // 缩略图
  thumbnail?: string
}

export interface ExportTemplate {
  id: string
  name: string
  type: ExportType
  description: string
  isDefault: boolean
}

export interface ExportProgress {
  stage: 'preparing' | 'processing' | 'generating' | 'finalizing' | 'completed' | 'error'
  progress: number // 0-100
  message: string
  error?: string
}

export interface ExportEngine {
  type: ExportType
  generate(data: ExportData, options: ExportOptions, onProgress?: (progress: ExportProgress) => void): Promise<Blob>
  preview?(data: ExportData, options: ExportOptions): Promise<string>
  getSupportedOptions(): Partial<ExportOptions>
}

export interface ExportResult {
  success: boolean
  blob?: Blob
  fileName: string
  fileSize?: number
  error?: string
}